package com.jingtai.core.entity;


import com.alibaba.excel.annotation.ExcelIgnore;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.jingtai.common.constants.DateConstant;
import com.jingtai.validate.swagger.CApiModelProperty;
import lombok.Data;
import org.springframework.data.annotation.CreatedDate;
import org.springframework.data.annotation.LastModifiedDate;

import java.io.Serializable;
import java.util.Date;

import io.swagger.annotations.*;

/**
 * Description:
 * Create DateTime: 2020-03-25 18:20
 *
 * @author houyi
 */
@ApiModel(value = "父bean", description = "父bean")
@Data
public class BaseEntity implements Serializable {

    @CApiModelProperty(value = "ID",required = true,groups = {Update.class})
    /**
     * 主键ID
     */
    @ExcelIgnore
    @TableId(value = "id", type = IdType.AUTO)
    protected Long id;

    @CApiModelProperty(value = "删除状态 0：未删除 1：已删除")
    /**
     * 删除标志
     */
    @ExcelIgnore
    protected Integer deleteFlag;

    @CApiModelProperty(value = "创建时间")
    /**
     * 创建时间
     */
    @CreatedDate
    @JsonFormat(pattern = DateConstant.DATE_FORMAT_NORMAL, timezone = DateConstant.TIME_ZONE)
    @ExcelIgnore
    protected Date createTime;

    @CApiModelProperty(value = "修改时间")
    /**
     * 修改时间
     */
    @LastModifiedDate
    @JsonFormat(pattern = DateConstant.DATE_FORMAT_NORMAL, timezone = DateConstant.TIME_ZONE)
    @ExcelIgnore
    @TableField(update = "now()")
    protected Date updateTime;


    public interface Login{

    }

    public interface Create{

    }

    public interface Update{

    }
}
